/**
 * HashMap对象
 */
function HashMap() {

    var size = 0;//map大小

    var entry = new Object();//实体
    /**
     * 存数据
     */
    this.put = function(key, value) {
        if (!this.containsKey(key)) {
            size++;
        }
        entry[key] = value;
    };
    /**
     * 取数据
     */
    this.get = function(key) {
        return this.containsKey(key) ? entry[key] : null;
    };
    /**
     * 删除数据 根据key来删
     */
    this.remove = function(key) {
        if (this.containsKey(key) && (delete entry[key])) {
            size--;
        }
    };
    /**
     * 是否包含key
     */
    this.containsKey = function(key) {
        return (key in entry);
    };
    /**
     * 是否包含值
     */
    this.containsValue = function(value) {
        for ( var prop in entry) {
            if (entry[prop] == value) {
                return true;
            }
        }
        return false;
    };
    /**
     * 返回值的集合
     */
    this.values = function() {
        var values = new Array();
        for ( var prop in entry) {
            values.push(entry[prop]);
        }
        return values;
    };
    /**
     * 返回key的集合
     */
    this.keys = function() {
        var keys = new Array();
        for ( var prop in entry) {
            keys.push(prop);
        }
        return keys;
    };
    /**
     * 返回map的大小
     */
    this.size = function() {
        return size;
    };
    /**
     * 清空map
     */
    this.clear = function() {
        size = 0;
        entry = new Object();
    };
};